<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: FSelector::BaseDiscrete
  
    &mdash; FSelector Documentation
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '..';
  if (relpath != '') relpath += '/';
</script>

  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="../_index.html">Index (B)</a> &raquo; 
    <span class='title'><span class='object_link'><a href="../FSelector.html" title="FSelector (module)">FSelector</a></span></span>
     &raquo; 
    <span class="title">BaseDiscrete</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a id="class_list_link" href="#">Class List</a>
  
    <a id="method_list_link" href="#">Method List</a>
  
    <a id="file_list_link" href="#">File List</a>
  
</div>
      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><h1>Class: FSelector::BaseDiscrete
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName"><span class='object_link'><a href="Base.html" title="FSelector::Base (class)">Base</a></span></span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next"><span class='object_link'><a href="Base.html" title="FSelector::Base (class)">Base</a></span></li>
          
            <li class="next">FSelector::BaseDiscrete</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
      <dt class="r2">Includes:</dt>
      <dd class="r2"><span class='object_link'><a href="../Discretizer.html" title="Discretizer (module)">Discretizer</a></span></dd>
      
    
  
  
  
    <dt class="r1 last">Defined in:</dt>
    <dd class="r1 last">lib/fselector/algo_base/base_discrete.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>base alogrithm for discrete feature</p>

<pre class="code ruby"><code>many algos are based on the following 2 x 2 contingency table

      c   c'
    ---------
 f  | A | B | A+B
    |---|---| 
 f' | C | D | C+D
    ---------
     A+C B+D  N = A+B+C+D

 P(f)     = (A+B)/N
 P(f')    = (C+D)/N
 P(c)     = (A+C)/N
 P(c')    = (B+D)/N
 P(f,c)   = A/N
 P(f,c')  = B/N
 P(f',c)  = C/N
 P(f',c') = D/N
 P(f|c)   = A/(A+C)
 P(f|c')  = B/(B+D)
 P(f'|c)  = C/(A+C)
 P(f'|c') = D/(B+D)
</code></pre>


  </div>
</div>
<div class="tags">
  

</div><div id="subclasses">
  <h2>Direct Known Subclasses</h2>
  <p class="children"><span class='object_link'><a href="Accuracy.html" title="FSelector::Accuracy (class)">Accuracy</a></span>, <span class='object_link'><a href="AccuracyBalanced.html" title="FSelector::AccuracyBalanced (class)">AccuracyBalanced</a></span>, <span class='object_link'><a href="BiNormalSeparation.html" title="FSelector::BiNormalSeparation (class)">BiNormalSeparation</a></span>, <span class='object_link'><a href="ChiSquaredTest.html" title="FSelector::ChiSquaredTest (class)">ChiSquaredTest</a></span>, <span class='object_link'><a href="CorrelationCoefficient.html" title="FSelector::CorrelationCoefficient (class)">CorrelationCoefficient</a></span>, <span class='object_link'><a href="DocumentFrequency.html" title="FSelector::DocumentFrequency (class)">DocumentFrequency</a></span>, <span class='object_link'><a href="F1Measure.html" title="FSelector::F1Measure (class)">F1Measure</a></span>, <span class='object_link'><a href="FastCorrelationBasedFilter.html" title="FSelector::FastCorrelationBasedFilter (class)">FastCorrelationBasedFilter</a></span>, <span class='object_link'><a href="FishersExactTest.html" title="FSelector::FishersExactTest (class)">FishersExactTest</a></span>, <span class='object_link'><a href="GMean.html" title="FSelector::GMean (class)">GMean</a></span>, <span class='object_link'><a href="GSSCoefficient.html" title="FSelector::GSSCoefficient (class)">GSSCoefficient</a></span>, <span class='object_link'><a href="GiniIndex.html" title="FSelector::GiniIndex (class)">GiniIndex</a></span>, <span class='object_link'><a href="INTERACT.html" title="FSelector::INTERACT (class)">INTERACT</a></span>, <span class='object_link'><a href="InformationGain.html" title="FSelector::InformationGain (class)">InformationGain</a></span>, <span class='object_link'><a href="JMeasure.html" title="FSelector::JMeasure (class)">JMeasure</a></span>, <span class='object_link'><a href="KLDivergence.html" title="FSelector::KLDivergence (class)">KLDivergence</a></span>, <span class='object_link'><a href="MatthewsCorrelationCoefficient.html" title="FSelector::MatthewsCorrelationCoefficient (class)">MatthewsCorrelationCoefficient</a></span>, <span class='object_link'><a href="McNemarsTest.html" title="FSelector::McNemarsTest (class)">McNemarsTest</a></span>, <span class='object_link'><a href="MutualInformation.html" title="FSelector::MutualInformation (class)">MutualInformation</a></span>, <span class='object_link'><a href="OddsRatio.html" title="FSelector::OddsRatio (class)">OddsRatio</a></span>, <span class='object_link'><a href="OddsRatioNumerator.html" title="FSelector::OddsRatioNumerator (class)">OddsRatioNumerator</a></span>, <span class='object_link'><a href="Power.html" title="FSelector::Power (class)">Power</a></span>, <span class='object_link'><a href="Precision.html" title="FSelector::Precision (class)">Precision</a></span>, <span class='object_link'><a href="ProbabilityRatio.html" title="FSelector::ProbabilityRatio (class)">ProbabilityRatio</a></span>, <span class='object_link'><a href="Sensitivity.html" title="FSelector::Sensitivity (class)">Sensitivity</a></span>, <span class='object_link'><a href="Specificity.html" title="FSelector::Specificity (class)">Specificity</a></span>, <span class='object_link'><a href="SymmetricalUncertainty.html" title="FSelector::SymmetricalUncertainty (class)">SymmetricalUncertainty</a></span></p>
</div>







  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">- (BaseDiscrete) <strong>initialize</strong>(data = nil) </a>
    

    
  </span>
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>initialize from an existing data structure.</p>
</div></span>
  
</li>

      
    </ul>
  


  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="../Discretizer.html" title="Discretizer (module)">Discretizer</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="../Discretizer.html#discretize_by_Chi2%21-instance_method" title="Discretizer#discretize_by_Chi2! (method)">#discretize_by_Chi2!</a></span>, <span class='object_link'><a href="../Discretizer.html#discretize_by_ChiMerge%21-instance_method" title="Discretizer#discretize_by_ChiMerge! (method)">#discretize_by_ChiMerge!</a></span>, <span class='object_link'><a href="../Discretizer.html#discretize_by_MID%21-instance_method" title="Discretizer#discretize_by_MID! (method)">#discretize_by_MID!</a></span>, <span class='object_link'><a href="../Discretizer.html#discretize_by_TID%21-instance_method" title="Discretizer#discretize_by_TID! (method)">#discretize_by_TID!</a></span>, <span class='object_link'><a href="../Discretizer.html#discretize_by_equal_frequency%21-instance_method" title="Discretizer#discretize_by_equal_frequency! (method)">#discretize_by_equal_frequency!</a></span>, <span class='object_link'><a href="../Discretizer.html#discretize_by_equal_width%21-instance_method" title="Discretizer#discretize_by_equal_width! (method)">#discretize_by_equal_width!</a></span></p>

  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="../Entropy.html" title="Entropy (module)">Entropy</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="../Entropy.html#get_conditional_entropy-instance_method" title="Entropy#get_conditional_entropy (method)">#get_conditional_entropy</a></span>, <span class='object_link'><a href="../Entropy.html#get_information_gain-instance_method" title="Entropy#get_information_gain (method)">#get_information_gain</a></span>, <span class='object_link'><a href="../Entropy.html#get_joint_entropy-instance_method" title="Entropy#get_joint_entropy (method)">#get_joint_entropy</a></span>, <span class='object_link'><a href="../Entropy.html#get_marginal_entropy-instance_method" title="Entropy#get_marginal_entropy (method)">#get_marginal_entropy</a></span>, <span class='object_link'><a href="../Entropy.html#get_symmetrical_uncertainty-instance_method" title="Entropy#get_symmetrical_uncertainty (method)">#get_symmetrical_uncertainty</a></span></p>

  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="../Consistency.html" title="Consistency (module)">Consistency</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="../Consistency.html#get_IR-instance_method" title="Consistency#get_IR (method)">#get_IR</a></span>, <span class='object_link'><a href="../Consistency.html#get_IR_by_count-instance_method" title="Consistency#get_IR_by_count (method)">#get_IR_by_count</a></span>, <span class='object_link'><a href="../Consistency.html#get_IR_by_feature-instance_method" title="Consistency#get_IR_by_feature (method)">#get_IR_by_feature</a></span>, <span class='object_link'><a href="../Consistency.html#get_instance_count-instance_method" title="Consistency#get_instance_count (method)">#get_instance_count</a></span></p>

  
  
  
  
  
  
  
  <h3 class="inherited">Methods inherited from <span class='object_link'><a href="Base.html" title="FSelector::Base (class)">Base</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="Base.html#algo_type-instance_method" title="FSelector::Base#algo_type (method)">#algo_type</a></span>, <span class='object_link'><a href="Base.html#each_class-instance_method" title="FSelector::Base#each_class (method)">#each_class</a></span>, <span class='object_link'><a href="Base.html#each_feature-instance_method" title="FSelector::Base#each_feature (method)">#each_feature</a></span>, <span class='object_link'><a href="Base.html#each_sample-instance_method" title="FSelector::Base#each_sample (method)">#each_sample</a></span>, <span class='object_link'><a href="Base.html#get_class_labels-instance_method" title="FSelector::Base#get_class_labels (method)">#get_class_labels</a></span>, <span class='object_link'><a href="Base.html#get_classes-instance_method" title="FSelector::Base#get_classes (method)">#get_classes</a></span>, <span class='object_link'><a href="Base.html#get_data-instance_method" title="FSelector::Base#get_data (method)">#get_data</a></span>, <span class='object_link'><a href="Base.html#get_data_copy-instance_method" title="FSelector::Base#get_data_copy (method)">#get_data_copy</a></span>, <span class='object_link'><a href="Base.html#get_feature_ranks-instance_method" title="FSelector::Base#get_feature_ranks (method)">#get_feature_ranks</a></span>, <span class='object_link'><a href="Base.html#get_feature_scores-instance_method" title="FSelector::Base#get_feature_scores (method)">#get_feature_scores</a></span>, <span class='object_link'><a href="Base.html#get_feature_type-instance_method" title="FSelector::Base#get_feature_type (method)">#get_feature_type</a></span>, <span class='object_link'><a href="Base.html#get_feature_values-instance_method" title="FSelector::Base#get_feature_values (method)">#get_feature_values</a></span>, <span class='object_link'><a href="Base.html#get_features-instance_method" title="FSelector::Base#get_features (method)">#get_features</a></span>, <span class='object_link'><a href="Base.html#get_opt-instance_method" title="FSelector::Base#get_opt (method)">#get_opt</a></span>, <span class='object_link'><a href="Base.html#get_sample_size-instance_method" title="FSelector::Base#get_sample_size (method)">#get_sample_size</a></span>, <span class='object_link'><a href="Base.html#select_feature%21-instance_method" title="FSelector::Base#select_feature! (method)">#select_feature!</a></span>, <span class='object_link'><a href="Base.html#select_feature_by_rank%21-instance_method" title="FSelector::Base#select_feature_by_rank! (method)">#select_feature_by_rank!</a></span>, <span class='object_link'><a href="Base.html#select_feature_by_score%21-instance_method" title="FSelector::Base#select_feature_by_score! (method)">#select_feature_by_score!</a></span>, <span class='object_link'><a href="Base.html#set_classes-instance_method" title="FSelector::Base#set_classes (method)">#set_classes</a></span>, <span class='object_link'><a href="Base.html#set_data-instance_method" title="FSelector::Base#set_data (method)">#set_data</a></span>, <span class='object_link'><a href="Base.html#set_feature_type-instance_method" title="FSelector::Base#set_feature_type (method)">#set_feature_type</a></span>, <span class='object_link'><a href="Base.html#set_features-instance_method" title="FSelector::Base#set_features (method)">#set_features</a></span>, <span class='object_link'><a href="Base.html#set_opt-instance_method" title="FSelector::Base#set_opt (method)">#set_opt</a></span></p>

  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="../ReplaceMissingValues.html" title="ReplaceMissingValues (module)">ReplaceMissingValues</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="../ReplaceMissingValues.html#replace_by_fixed_value%21-instance_method" title="ReplaceMissingValues#replace_by_fixed_value! (method)">#replace_by_fixed_value!</a></span>, <span class='object_link'><a href="../ReplaceMissingValues.html#replace_by_knn_value%21-instance_method" title="ReplaceMissingValues#replace_by_knn_value! (method)">#replace_by_knn_value!</a></span>, <span class='object_link'><a href="../ReplaceMissingValues.html#replace_by_mean_value%21-instance_method" title="ReplaceMissingValues#replace_by_mean_value! (method)">#replace_by_mean_value!</a></span>, <span class='object_link'><a href="../ReplaceMissingValues.html#replace_by_median_value%21-instance_method" title="ReplaceMissingValues#replace_by_median_value! (method)">#replace_by_median_value!</a></span>, <span class='object_link'><a href="../ReplaceMissingValues.html#replace_by_most_seen_value%21-instance_method" title="ReplaceMissingValues#replace_by_most_seen_value! (method)">#replace_by_most_seen_value!</a></span></p>

  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="../FileIO.html" title="FileIO (module)">FileIO</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="../FileIO.html#data_from_csv-instance_method" title="FileIO#data_from_csv (method)">#data_from_csv</a></span>, <span class='object_link'><a href="../FileIO.html#data_from_libsvm-instance_method" title="FileIO#data_from_libsvm (method)">#data_from_libsvm</a></span>, <span class='object_link'><a href="../FileIO.html#data_from_random-instance_method" title="FileIO#data_from_random (method)">#data_from_random</a></span>, <span class='object_link'><a href="../FileIO.html#data_from_url-instance_method" title="FileIO#data_from_url (method)">#data_from_url</a></span>, <span class='object_link'><a href="../FileIO.html#data_from_weka-instance_method" title="FileIO#data_from_weka (method)">#data_from_weka</a></span>, <span class='object_link'><a href="../FileIO.html#data_to_csv-instance_method" title="FileIO#data_to_csv (method)">#data_to_csv</a></span>, <span class='object_link'><a href="../FileIO.html#data_to_libsvm-instance_method" title="FileIO#data_to_libsvm (method)">#data_to_libsvm</a></span>, <span class='object_link'><a href="../FileIO.html#data_to_weka-instance_method" title="FileIO#data_to_weka (method)">#data_to_weka</a></span></p>
<div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <p class="signature first" id="initialize-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="FSelector::BaseDiscrete (class)">BaseDiscrete</a></span></tt>) <strong>initialize</strong>(data = nil) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>initialize from an existing data structure</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


36
37
38</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/fselector/algo_base/base_discrete.rb', line 36</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
  
</div>


</div>
    
    <div id="footer">
  Generated on Mon Nov  5 11:19:46 2012 by 
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.7.5 (ruby-1.9.3).
</div>

  </body>
</html>